package com.lzy.concertticket.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzy.concertticket.dao.mapper.UserMapper;
import com.lzy.concertticket.model.entity.UserEntity;
import com.lzy.concertticket.model.req.UserReq;
import org.springframework.stereotype.Service;

/**
* @author 30793
* @description 针对表【tb_user】的数据库操作Service实现
* @createDate 2025-08-15 22:50:26
*/
@Service
public class UserDao extends ServiceImpl<UserMapper, UserEntity> {

    public UserEntity getUserByAccount(String account) {
        return baseMapper.selectUserByAccount(account);
    }

    public Page<UserEntity> getUserPage(UserReq userReq) {
        Page<UserEntity> page = new Page<>(userReq.getPageNum(), userReq.getPageSize());
        return baseMapper.getUserPage(page, userReq);
    }

    public UserEntity getInfo(UserReq userReq) {
        Long id = userReq.getId();
        String username = userReq.getUsername();
        String phone = userReq.getPhone();
        String email = userReq.getEmail();
        return baseMapper.selectByIdOrUsernameOrPhoneOrEmail(id, username, phone, email);
    }
}




